<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="my"  uri="http://www.trkj.com/tr1702/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>考试安排</title>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/jquery.easyui.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/locale/easyui-lang-zh_CN.js"/>"></script>
<link id="theme" rel="stylesheet" type="text/css"  href="<c:url value="js/jquery-easyui-1.5.4.2/themes/ui-cupertino/easyui.css"/>"/>
<link  rel="stylesheet" type="text/css" href="<c:url value="js/jquery-easyui-1.5.4.2/themes/icon.css"/>"/>

<body>
<script type="text/javascript">

$(function(){
	$(".ksap_insert").linkbutton({
		onClick:function(){
			$(".ksap_").panel({
				href:"ksap_insert"
				
			})
		}
	})
	
	$('#ksap1').textbox({
		icons: [{
			iconCls:'icon-add',
			handler: function(e){
				$("#ksap2").dialog("open");
			}
		}]
	})
	
	$("#ksap_clear").linkbutton({onClick:function(){
		//找到选中的行
		var row = $("#hhy_ksap_findAll_datagrid").datagrid("getSelected");
		if(!row){
			$.messager.alert('提示', '没有选中要删除的行！');
			return;
		}
		
		$.messager.confirm('确认', '真的要删除吗？', function(v){
			$("<form method = 'post'>").appendTo(document.body).form({
				url:'ksap_delete',
				onSubmit:function(params){
					params["arrangeId"] =row.arrangeId;
				},success:function(v){
					v = eval("(" + v + ")");
					if(v.success){
						
						$.messager.alert('恭喜', '删除成功');
						$('#hhy_ksap_findAll_datagrid').datagrid('reload');
					}else{
						$.messager.alert('错误', '对不起，操作失败，原因：' + v.message);
					}
				}
			}).submit();

		});
	}});
	
	<my:g id="151">$("#hhy_ksap_findAll_datagrid").datagrid({onDblClickRow:function(row){
		//找到选中的行
		var row = $("#hhy_ksap_findAll_datagrid").datagrid("getSelected");
		if(!row){
			$.messager.alert('提示', '没有选中要编辑的行！');
			return;
		}
			$(".ksap_").panel({
				
				href:"ksap_update?arrangeId="+row.arrangeId+"&classSjName="+row.classSjName
				
			})
		}

	});
	</my:g>
	
	
});

function onSelect(d) {
    var issd = this.id == 'ksap_sd', sd = issd ? d : new Date($('#ksap_sd').datebox('getValue')), ed = issd ? new Date($('#ksap_ed').datebox('getValue')) : d;
        if (ed < sd) {
            alert('结束日期小于开始日期');
            //只要选择了日期，不管是开始或者结束都对比一下，如果结束小于开始，则清空结束日期的值并弹出日历选择框
            $('#ksap_ed').datebox('setValue', '').datebox('open');
        }
    }
</script>
<style>
	.line{
		margin:10px 20px;
	}
</style>

<div class="easyui-panel ksap_" data-options="fit:true,border:false">
	<table class="easyui-datagrid" id="hhy_ksap_findAll_datagrid" style="text-align:center;width:100%;" data-options="
		method:'post',
		url:'to_ksap_findAll',
		fitColumns:true,
		fit:true,
		nowrap:false,
		autoRowHeight:true,
		rownumbers:true,
		singleSelect:true,
		pagination:true,
		pageList:[5,10,15,20],
		pageSize:5,
		striped:true,
		toolbar:'#ksap'
	">
		<thead>
			<tr>
				<th data-options="field:'arrangeId',align:'center',width:20">编号</th>
				<th data-options="field:'arrangeName',align:'center',width:30">名称</th>
				<th data-options="field:'classSjName',align:'center',width:30">试卷名称</th>
				<th data-options="field:'epTotal',align:'center',width:20">总分</th>
				<th data-options="field:'epStarttime',align:'center',width:60,
				formatter:function(value,row,index){
					var date= new Date(value);
					return date.toLocaleString();
				}">开始时间</th>
				<th data-options="field:'epEndtime',align:'center',width:60,
				formatter:function(value,row,index){
					var date= new Date(value);
					return date.toLocaleString();
				}">结束时间</th>
				<th data-options="field:'epShichang',align:'center',width:20">时长</th>
				<th data-options="field:'arrangeUnifyEspecial',align:'center',width:20">统一开考</th>
				<th data-options="field:'arrangeLookAnswer',align:'center',width:20">查看答案</th>
				<th data-options="field:'arrangeNumberExaminee',align:'center',width:20">考生数</th>
				<th data-options="field:'arrangeNumberAdministrator',align:'center',width:20">管理员数</th>
				<th data-options="field:'arrangeAddress',align:'center',width:50">地址</th>
				<th data-options="field:'arrangeRemark',align:'center',width:30">备注</th>
				<th data-options="field:'arrangeStart',align:'center',width:30">考场状态</th>
			</tr>
		</thead>
		<tbody>
			
		</tbody>
	</table>
	<div id="ksap">
		<my:g id="149"><a href="#" class="easyui-linkbutton ksap_insert" data-options="iconCls:'icon-add',plain:true,text:'添加'"></a></my:g>
		<my:g id="150"><a href="#" class="easyui-linkbutton" id="ksap_clear" data-options="iconCls:'icon-clear',plain:true,text:'删除'"></a></my:g>
		开始日期：<input class="easyui-datebox" id="ksap_sd" data-options="onSelect:onSelect,editable:false" />
		结束日期：<input class="easyui-datebox" id="ksap_ed" data-options="onSelect:onSelect,editable:false" />
		搜索文本  <input id="bir" class="easyui-textbox" data-options="width:100,height:25,placeholder:'编号，名称'">
		考试安排  <input class="easyui-textbox" id="ksap1" data-options="width:150,height:25"/>
		<a id="btn" class="easyui-linkbutton" data-options="width:60,height:25,plain:false,text:'搜索'"></a> 
	</div>
	<div class="easyui-dialog" id="ksap2" data-options="width:550,height:400,title:'清单查找-试卷',
				modal:true,
				closed:true,
				buttons:[{
					text:'确定',
					iconCls:'icon-ok',
					handler:function(){
						$('#f').form({
							onSubmit:function(){
								return $(this).form('validate');
							},success:function(v){
								$.messager.alert('提示','添加成功！');
								$('#win').dialog('close');
								location.reload();
							}
						}).submit();
					}
				},{
					text:'取消',
					iconCls:'icon-clear',
					handler:function(){
						$('#f').form('close');			
					}
				}]">
				<form action="" method="post" id="f_ksap">
					<div class="line">
						<input class="easyui-textbox" name="planid" data-options="label:'试卷编号',width:300,height:25"/>
					</div>
					<div class="line">
						<input class="easyui-textbox" name="planname" data-options="label:'试卷名称',width:300,height:25"/>
					</div>
					<div class="line">
						<select id="sex" class="easyui-combobox" data-options="label:'题库',width:300,height:25,panelHeight:'auto',labelWidth:85">
						<option>未开考</option>
						<option>考试中</option>
						<option>已交卷</option>
						</select>
						
						<a class="easyui-linkbutton" name="vague" data-options="text:'模糊查询',width:100,height:25" style="float:right"/>
						
					</div>
					<div class="line">
						<select id="sex" class="easyui-combobox" data-options="label:'知识组',width:300,height:25,panelHeight:'auto',labelWidth:85">
						<option>未开考</option>
						<option>考试中</option>
						<option>已交卷</option>
						</select>
						<a class="easyui-linkbutton" name="vague" data-options="text:'搜索',width:100,height:25" style="float:right"/>
					</div>
					<div class="line">
						<table class="easyui-datagrid" data-options="
							pagination:true,
							pageSize:10,
							pageList:[5,10,15,20,25],
							autoRowHeight:true,
							nowrap:false,
							autoRowHeight:true,
							rownumbers:true,
							singleSelect:true,
							striped:true">
							<thead>
							  <tr>
								<th data-options="width:120,align:'center',field:'planid'">试卷编号</th>
								<th data-options="width:120,align:'center',field:'empname'">试卷名称</th>
							 	<th data-options="width:120,align:'center',field:'planid'">题库组</th>
								<th data-options="width:120,align:'center',field:'empname'">知识组</th>
							  </tr>
							</thead>
							<tbody>
							<c:forEach begin="1" end="3">
							  <tr>
							    <td>C1001</td>
							    <td>admin</td>
							    <td>C1001</td>
							    <td>admin</td>
							  </tr>
							 </c:forEach>
							</tbody>
						</table>
					</div>
				</form>
			</div>
		</div>
</body>
</html>